package com.rmb.controller;

import com.rmb.annotation.SystemLog;
import com.rmb.common.model.response.CommonCode;
import com.rmb.enums.LogType;
import com.rmb.service.WriteExcelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
/**
 * @version 1.0
 * @Author a
 * @Date 2021/1/8 19:40
 */
@RestController
@RequestMapping("/rmb/writeExcel")
public class WriteExcelController {
    @Autowired
    WriteExcelService writeExcelService;

    /**
     * 从数据库获取数据存入Excel表单中
     * @param dizhi 地址
     * @param sname s名称
     * @param xname x名称
     * @return 结果集
     * @throws IOException
     */
    @PostMapping("/write")
    @SystemLog(description = "从数据库读取写道Excel中",type = LogType.INSERT)
    public CommonCode writeExcel(String dizhi, String sname, String xname) throws IOException {
        writeExcelService.writeexcel(dizhi,sname,xname);
        return CommonCode.SUCCESS;
    }
}
